<template>
	<div>
		<el-dialog :title="$t('action.add')" width="70%" class="icon-dialog" :visible.sync="show" @open="open" :before-close="closeForm" append-to-body>
			<el-form :size="size" ref="form" :model="form" :rules="rules" :label-width="$store.getters.device !== 'mobile'?'16%':'90px'">
 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_billNo')" prop="billNo">
							<el-input v-model="form.billNo" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_billNo')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_prdorgId')" prop="prdorgId">
							<el-input v-model="form.prdorgId" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_prdorgId')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_workShop')" prop="workShop">
							<el-input v-model="form.workShop" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_workShop')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_fqty')" prop="fqty">
							<el-input v-model="form.fqty" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_fqty')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_unit')" prop="unit">
							<el-input v-model="form.unit" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_unit')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_documentStatus')" prop="documentStatus">
							<el-input v-model="form.documentStatus" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_documentStatus')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_createDate')" prop="createDate">
							<el-input v-model="form.createDate" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_createDate')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_modifyDate')" prop="modifyDate">
							<el-input v-model="form.modifyDate" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_modifyDate')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_taskBillNo')" prop="taskBillNo">
							<el-input v-model="form.taskBillNo" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_taskBillNo')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_taskMaterialNo')" prop="taskMaterialNo">
							<el-input v-model="form.taskMaterialNo" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_taskMaterialNo')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_taskMaterialName')" prop="taskMaterialName">
							<el-input v-model="form.taskMaterialName" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_taskMaterialName')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_taskSpecification')" prop="taskSpecification">
							<el-input v-model="form.taskSpecification" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_taskSpecification')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_taskUnit')" prop="taskUnit">
							<el-input v-model="form.taskUnit" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_taskUnit')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_fId')" prop="fId">
							<el-input v-model="form.fId" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_fId')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proppbom_entrySeq')" prop="entrySeq">
							<el-input v-model="form.entrySeq" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proppbom_entrySeq')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
				</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button :size="size" :loading="loading" type="primary" @click="submit" >
					<span v-if="!loading">{{$t('system.confirm')}}</span>
					<span v-else>{{$t('system.submitting')}}</span>
				</el-button>
				<el-button :size="size" @click="closeForm">{{$t('system.cancel')}}</el-button>
			</div>
		</el-dialog>
	</div>
</template>
<script>
import { add } from '@/api/app/proppbom'



export default {
	name:'proppbomadd',
	components: {
	   	   
	},
	props: {
		show: {
			type: Boolean,
			default: false
		},
		size: {
			type: String,
			default: 'small'
		},
		querys:{
			type:Object,
		},
	},
	data(){
		return {
		    dialog:{
			},
			
			form: {
			   billNo:'',
			   prdorgId:'',
			   workShop:'',
			   fqty:'',
			   unit:'',
			   documentStatus:'',
			   createDate:'',
			   modifyDate:'',
			   taskBillNo:'',
			   taskMaterialNo:'',
			   taskMaterialName:'',
			   taskSpecification:'',
			   taskUnit:'',
			   fId:'',
			   entrySeq:'',
			},
		    initial:{},   
			loading:false,
			rules: {
			}
		}
	},
	watch:{
		show(val){
			if(val){
			}
		}
	},
	methods: {
		open(){
		  if(this.querys){
		  }
		},
		submit(){
			this.$refs['form'].validate(valid => {
				if(valid) {
					this.loading = true
					add(this.form).then(res => {
						if(res.status == 200){
							this.$message({message: this.$t('system.success'), type: 'success'})
							this.$emit('refresh_list')
							this.closeForm()
						}
					}).catch(()=>{
						this.loading = false
					})
				}
			})
		},
		closeForm(){
			this.$emit('update:show', false)
			this.loading = false
			if (this.$refs['form']!==undefined) {
				this.$refs['form'].resetFields()
			}
		},
	}
}
</script>
<style scoped lang="scss">
@import '@/assets/scss/common.scss'
</style>
